package com.zb.vo;

import com.zb.entity.ZjGoodsSpec;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/8/2 0002
 **/
@Data
@ApiModel("规格内容列表对象")
public class GoodsSpecListVo {
    @ApiModelProperty(value = "规格ID")
    private Long id;

    @ApiModelProperty(value = "规格名称")
    private String name;

    @ApiModelProperty(value = "是否禁用：0-否，1-是")
    private Boolean status;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "规格内容")
    private String content;

    public static GoodsSpecListVo beanToVo(ZjGoodsSpec spec, String content) {
        GoodsSpecListVo vo = new GoodsSpecListVo();
        BeanUtils.copyProperties(spec, vo);
        vo.setStatus(spec.getDisabled());
        vo.setCreateTime(spec.getGmtCreate());
        vo.setUpdateTime(spec.getGmtUpdate());
        vo.setContent(content);
        return vo;
    }
}
